package com.lee.mvc.controller;

import com.lee.mvc.dao.UserMapper;
import com.lee.mvc.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * User:liwei
 * Date:2017/8/14
 * Time:9:20
 */
@Controller
public class HelloController {

    @Autowired
    UserMapper userMapper;

    @RequestMapping("/hello")
    @ResponseBody
    public String hello(User user){
        System.out.println(userMapper.selectByPrimaryKey(1l).getUsername());
        return "hello world";
    }

    @RequestMapping("/sayhello")
    public String sayhello(User user){
        System.out.println(user.getUsername());
        return "/helloworld/helloworld";
    }
}
